﻿<assign name="title" value="CryptoJS演示" />
<include file="top.html" />
	<h3>基本演示：程序-/App/Controllers/CryptoJSController.asp，模板-/App/Views/default/Home/CryptoJS.html</h3>
	<form onsubmit="if(!clicked)return false;" target="target_frame" method="post" name="hash_crypt">
		<h4>哈希(HASH)算法</h4>
		<div>原始字符串：</div>
		<textarea cols="80" rows="4" name="txt_hash_src">这是一个hash测试字符串</textarea><br />
		算法：<select name="hash_select">
			<option value="md5">MD5</option>
			<option value="sha1">SHA1</option>
			<option value="sha3">SHA3</option>
			<option value="sha224">SHA224</option>
			<option value="sha256">SHA256</option>
			<option value="sha384">SHA384</option>
			<option value="sha512">SHA512</option>
			<option value="pbkdf2">PBKDF2</option>
			<option value="evpkdf">EVPKDF</option>
			<option value="ripemd160">RIPEMD160</option></select>
		SALT：<input type="text" name="salt" value="" /> <input type="button" onclick="clicked=true;Hash(this.form,'hash');" value="计算" />
		<div>结果字符串：</div>
		<textarea cols="80" rows="4" name="txt_hash_result"></textarea>
		<h4>加/解密算法</h4>
		<div>原始字符串：</div>
		<textarea cols="80" rows="4" name="txt_crypt_src">这是一个crypt测试字符串，用来测试各种加密！</textarea><br />
		算法：<select name="crypt_select" style="width:130px" onclick="select_crypt_select(this);">
			<option value="aes">AES</option>
			<option value="des">DES</option>
			<option value="rc4">RC4</option>
			<option value="rabbit">RABBIT</option>
			<option value="rabbitlegacy">RABBITLEGACY</option>
			<option value="base64">BASE64(编码算法)</option>
		</select>
		<span id="span_crypt_key">密码：<input type="text" name="crypt_key" value="f2c20576f726c641" /></span>
			<input type="button" onclick="clicked=true;Hash(this.form,'crypt','encrypt');" value="加密" />
			<input type="button" onclick="clicked=true;Hash(this.form,'crypt','decrypt');" value="解密" /><br />
		<span id="span_crypt_mode">模式：<select name="crypt_mode" style="width:130px">
			<option value="CBC">CBC</option>
			<option value="CFB">CFB</option>
			<option value="CTR">CTR</option>
			<option value="CTRGladman">CTRGladman</option>
			<option value="ECB">ECB</option>
			<option value="OFB">OFB</option>
		</select></span>
		<span id="span_crypt_padding">补丁算法：<select name="crypt_padding">
			<option value="ZeroPadding">ZeroPadding</option>
			<option value="NoPadding">NoPadding</option>
			<option value="AnsiX923">AnsiX923</option>
			<option value="Iso10126">Iso10126</option>
			<option value="Iso97971">Iso97971</option>
			<option value="Pkcs7">Pkcs7</option>
		</select></span>
		<span id="span_crypt_iv">偏移：<input type="text" name="crypt_iv" value="6f726c64f2c20572" /></span>
		<div>结果字符串：</div>
		<textarea cols="80" rows="4" name="txt_crypt_result"></textarea>
	</form>
	<iframe name="target_frame" frameborder="0" width="0" height="0"></iframe>
	<script type="text/javascript">
	var clicked=false;
	function Hash(frm,t,mode){
		frm.action="?t=" + t + "&mode=" + mode + "&m=CryptoJS&a=" + frm[t+"_select"].value;
		frm.submit();
		clicked=false;
	}
	function Callback(data){
		if(!data)return;
		document.forms["hash_crypt"]["txt_" + data.t + "_result"].value = data.value + (data.debug? ("\r\n[DEBUG]:\r\n" + data.debug) : "");
	}
	function select_crypt_select(sel){
		if(sel.value=="aes" || sel.value=="des"){
			document.getElementById("span_crypt_iv").style.display="inline";
			document.getElementById("span_crypt_mode").style.display="inline";
			document.getElementById("span_crypt_padding").style.display="inline";
		}else{
			document.getElementById("span_crypt_iv").style.display="none";
			document.getElementById("span_crypt_mode").style.display="none";
			document.getElementById("span_crypt_padding").style.display="none";
		}
	}
	</script>
<include file="foot.html" />